package com.example.demo.service.impl;

import com.example.demo.entity.Report;
import com.example.demo.mapper.UserMapper;
import com.example.demo.entity.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper usermapper;/*返回方法建议是返回值的全小写或首字母小写*/

    @Override
    public List<User> findAllUsers() {
        //System.out.println("start"+System.currentTimeMillis());/*记录时间日志*/
        List<User> users=usermapper.findAllUsers();
        //System.out.println("end"+System.currentTimeMillis());/*记录时间日志*/
        return users;
    }

    @Override
    public User findAUsers(String username){
        //System.out.println("start"+System.currentTimeMillis());/*记录时间日志*/
        User users=usermapper.findAUsers(username);
        //System.out.println("end"+System.currentTimeMillis());/*记录时间日志*/
        return users;
    }

    @Override
    public int deleteAUsers(String username) {
        //System.out.println("start"+System.currentTimeMillis());/*记录时间日志*/
        int users=usermapper.deleteAUsers(username);
        //System.out.println("end"+System.currentTimeMillis());/*记录时间日志*/
        return users;
    }

    @Override
    public int insertAUsers(User user) {
        //System.out.println("start"+System.currentTimeMillis());/*记录时间日志*/
        int users=usermapper.insertAUsers(user);
        //System.out.println("end"+System.currentTimeMillis());/*记录时间日志*/
        return users;
    }

    @Override
    public int changePWD(String username, String pwd) {
        int i = changePWD(username, pwd);
        return i;
    }

}
